package com.ruoyi.swimming.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.swimming.domian.MallGoodsSku;
import com.ruoyi.swimming.domian.MallOrderDetails;
import com.ruoyi.swimming.mapper.MallGoodsSkuMapper;
import com.ruoyi.swimming.mapper.MallOrderDetailsMapper;
import com.ruoyi.swimming.service.IMallOrderDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 订单详情Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-07-17
 */
@Service
public class MallOrderDetailsServiceImpl extends ServiceImpl<MallOrderDetailsMapper, MallOrderDetails> implements IMallOrderDetailsService
{
    @Autowired
    private MallOrderDetailsMapper mallOrderDetailsMapper;

    /**
     * 查询订单详情
     * 
     * @param id 订单详情ID
     * @return 订单详情
     */
    @Override
    public MallOrderDetails selectMallOrderDetailsById(Long id)
    {
        return mallOrderDetailsMapper.selectMallOrderDetailsById(id);
    }

    /**
     * 查询订单详情列表
     * 
     * @param mallOrderDetails 订单详情
     * @return 订单详情
     */
    @Override
    public List<MallOrderDetails> selectMallOrderDetailsList(MallOrderDetails mallOrderDetails)
    {
        return mallOrderDetailsMapper.selectMallOrderDetailsList(mallOrderDetails);
    }

    /**
     * 新增订单详情
     * 
     * @param mallOrderDetails 订单详情
     * @return 结果
     */
    @Override
    public int insertMallOrderDetails(MallOrderDetails mallOrderDetails)
    {
        mallOrderDetails.setCreateTime(DateUtils.getNowDate());
        return mallOrderDetailsMapper.insert(mallOrderDetails);
    }

    /**
     * 修改订单详情
     * 
     * @param mallOrderDetails 订单详情
     * @return 结果
     */
    @Override
    public int updateMallOrderDetails(MallOrderDetails mallOrderDetails)
    {
        mallOrderDetails.setUpdateTime(DateUtils.getNowDate());
        return mallOrderDetailsMapper.updateById(mallOrderDetails);
    }

    /**
     * 批量删除订单详情
     * 
     * @param ids 需要删除的订单详情ID
     * @return 结果
     */
    @Override
    public int deleteMallOrderDetailsByIds(Long[] ids)
    {
        return mallOrderDetailsMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除订单详情信息
     * 
     * @param id 订单详情ID
     * @return 结果
     */
    @Override
    public int deleteMallOrderDetailsById(Long id)
    {
        return mallOrderDetailsMapper.deleteById(id);
    }
}
